package com.example.birdfriends.utils.sort;

import com.example.birdfriends.pojo.post.Post;
import com.example.birdfriends.pojo.post.PostFront;
import javafx.geometry.Pos;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
public class Sort {
    public List<Post> sortByCreateAt(List<Post> posts){
        posts.sort((t1, t2) -> t2.getCreateAt().compareTo(t1.getCreateAt()));
        return posts;
    }

    public List<PostFront> sortPostByPraise(List<PostFront> postFrontList){
        postFrontList.sort((t1, t2) -> t2.getLikes().compareTo(t1.getLikes()));
        return postFrontList;
    }
}
